<?php

namespace app\model\article;

use app\BaseModel;
use think\model\relation\BelongsTo;
use think\model\relation\HasMany;

/**
 * 文章
 */
class ArticleModel extends BaseModel
{
    protected $name = 'article';

    /**
     * 文章标签
     * @return HasMany
     */
    public function Label(): HasMany
    {
        return $this->hasMany(ArticleLabelModel::class,'label_id');
    }

    /**
     * 文章类型
     */
    public function Type(): BelongsTo
    {
        return $this->belongsTo(ArticleTypeModel::class,'type_id')->bind([
            'type_name' => 'name',
        ]);
    }
}